﻿namespace Snipps.Infrastructure
{
    using System;

    using GalaSoft.MvvmLight;

    public abstract class BindableBase : ViewModelBase
    {
        protected void SetProperty<T>(ref T backingStore, T value, string propertyName, Action onChanged = null)
        {
            var isPropChanged = Set(propertyName, ref backingStore, value);

            if (onChanged != null && isPropChanged)
            {
                onChanged();
            }
        }
    }
}